package com.xuecheng.system.convert;

import com.xuecheng.api.system.DictionaryApi;
import com.xuecheng.api.system.model.dto.DictionaryDTO;
import com.xuecheng.system.entity.Dictionary;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * <p>
 * 数据字典 PO 和 DTO 转换器
 * </p>
 */
@Mapper
public interface DictionaryConvert {

    DictionaryConvert INSTANCE = Mappers.getMapper(DictionaryConvert.class);

    /**
     * 将数据转为 DTO 数据
     * @param dictionary
     * @return
     */
    @Mapping(source = "id", target = "dicId")
    DictionaryDTO entity2dto(Dictionary dictionary);

    /**
     * 将 PO 集合数据转为 DTO 集合数据
     * @param dictionarys
     * @return
     */
    List<DictionaryDTO> entitys2dtos(List<Dictionary> dictionarys);
}
